package com.spider.admin.store.primary.model;

import com.spider.admin.conf.StructVar;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;

import java.sql.Date;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;


@Getter
@Setter

@Validated
@Entity
@Table(name = "t_account_service_permissions")

@Accessors(chain = true)

@Data
@EqualsAndHashCode(callSuper = true)
public class AgentConf extends SuperVO {
    @Id
    private String pid;
    private String confType;
    private String belongServerId;
    private String belongAppId;
    private String confContext;
    private String confDesc;
    private String confVersion;
    private int confStatus;
    @Transient
    private String confStatusDisplay;

    public String getConfStatusDisplay() {
        switch (this.confStatus) {
            case StructVar.AGENT_CONF_CONTEXT_STATUS_INIT:
                this.confStatusDisplay = "初始";
                break;
            case StructVar.AGENT_CONF_CONTEXT_STATUS_VAL_FAIL:
                this.confStatusDisplay = "验证异常";
                break;
            case StructVar.AGENT_CONF_CONTEXT_STATUS_VAL_OK:
                this.confStatusDisplay = "验证成功";
                break;
            case StructVar.AGENT_CONF_CONTEXT_STATUS_PUBLISHED:
                this.confStatusDisplay = "已发布";
                break;
            case StructVar.AGENT_CONF_CONTEXT_STATUS_ONLINE:
                this.confStatusDisplay = "上线";
                break;
            case StructVar.AGENT_CONF_CONTEXT_STATUS_UNPUBLISHED:
                this.confStatusDisplay = "待发布";
                break;
            default:
                this.confStatusDisplay = null;
                break;
        }
        return this.confStatusDisplay;
    }

    private Timestamp updateTime;
}
